<html>
<body>
<!--template for the form-->
  <template id="form">
    <div>
      <label for="name">What's your name?</label>
      <input v-bind:value="value" type="text" id="name" v-on:input="onInput">
    </div>
  </template>
  
  <!--template for saying hello-->
  <template id="hello">
    <h1>{{msg}} {{user}}</h1>
  </template>
  
  <!--template for the greetings-->
  <template id="greetings">
    <div>
      <form-component v-model="user"></form-component>
      <hello-component :user="user"></hello-component>
    </div>
  </template>
  
  <div id="app">
    <greetings-component></greetings-component>
  </div>
<script src="https://vuejs.org/js/vue.js"></script>
<script>
Vue.component('form-component', {
  template: '#form',
  props: ['value'],
  methods: {
    onInput: function (event) {
      this.$emit('input', event.target.value)
    }
  }
});

Vue.component('hello-component', {
  template: '#hello',
  data: function () {
    return {
      msg: 'Hello'
    }
  },
  props: ['user']
});

Vue.component('greetings-component', {
  template: '#greetings',
  data: function () {
    return {
      user: 'hero'
    }
  }
});

new Vue({
  el: '#app'
});
</script>
</body>
</html>